package com.eastfair.home.controller;

import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.home.service.HomeDrawingService;
import com.eastfair.venueservice.dto.DrawingDTO;
import com.eastfair.venueservice.vo.DrawingVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * <p>
 * 前端控制器
 * 综合图纸分类
 * </p>
 *
 * @author dq
 * @date 2022-10-27
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/homeVenueDrawing")
@Api(value = "Drawing", tags = "场馆综合图纸分类")
public class HomeVenueDrawingController {

    @Resource
    private HomeDrawingService homeDrawingService;

    /**
     * 图纸列表
     *
     * @param drawingDTO the drawing page query
     * @return r
     */
    @PostMapping("/getDrawingList")
    public R<List<DrawingVO>> getDrawingList(@RequestBody DrawingDTO drawingDTO) {
        try {
            return R.success(homeDrawingService.getDrawingList(drawingDTO));
        } catch (BizException e) {
            return R.fail(e);
        }
    }
}
